﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Configuration;
using System.Web;
using System.Configuration.Provider;
using UrlRouter.Configuration.Provider;

namespace UrlRouter.Configuration
{
    public sealed class UrlRewriteSection : ConfigurationSection
    {
        /// <summary>
        /// 只重写虚拟urls 默认为true,防止重写实际存在的路径url
        /// </summary>
        [ConfigurationProperty("rewriteOnlyVirtualUrls", DefaultValue = true)]
        public bool RewriteOnlyVirtualUrls
        {
            get
            {
                return (bool)base["rewriteOnlyVirtualUrls"];
            }
            set
            {
                base["rewriteOnlyVirtualUrls"] = value;
            }
        }
        /// <summary>
        /// 为重写提供的驱动名称 ,默认为RegEx
        /// </summary>
        [ConfigurationProperty("defaultProvider", IsRequired = false, DefaultValue = "RegEx")]
        public string DefaultProvider
        {
            get
            {
                return (string)base["defaultProvider"];
            }
            set
            {
                base["defaultProvider"] = value;
            }
        }
        /// <summary>
        /// 无扩展名无法匹配的默认页
        /// </summary>
        [ConfigurationProperty("defaultPage", IsRequired = false, DefaultValue = "")]
        public string DefaultPage
        {
            get
            {
                return (string)base["defaultPage"];
            }
            set
            {
                base["defaultPage"] = value;
            }
        }

        /// <summary>
        /// 自定义的驱动组
        /// </summary>
        [ConfigurationProperty("providers")]
        public ProviderSettingsCollection Providers
        {
            get
            {
                return (ProviderSettingsCollection)base["providers"];
            }
        }
        /// <summary>
        /// 重写规则组
        /// </summary>
        [ConfigurationProperty("rewrites")]
        public RewriteSettingsCollection Rewrites
        {
            get
            {
                return (RewriteSettingsCollection)base["rewrites"];
            }
        }
        /// <summary>
        /// items[] 缓存的前缀 默认为QueryString
        /// </summary>
        [ConfigurationProperty("contextItemsPrefix", DefaultValue = "")]
        public string ContextItemsPrefix
        {
            get
            {
                return (string)base["contextItemsPrefix"];
            }
            set
            {
                base["contextItemsPrefix"] = value;
            }
        }
        /// <summary>
        /// 智能感知输入提示的xsd类
        /// </summary>
        [ConfigurationProperty("xmlns", DefaultValue = "")]
        public string XmlNs
        {
            get
            {
                return (string)base["xmlns"];
            }
            set
            {
                base["xmlns"] = value;
            }
        }

    }
}
